<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta  charset="utf-8">
<meta  name="viewport"  content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>一元夺宝</title>
<link  rel="stylesheet"  href="../addons/feng_duobao/template/css/css.css">
<link  rel="stylesheet"  href="../addons/feng_duobao/template/css/duobao.css">

<script   src="../addons/feng_duobao/template/js/jquery.js" type="text/javascript"></script>
<script  src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js" type="text/javascript"></script>
</head>
<body  style="background:#f6f6f8;">
<section  class="top_bar"> 
	<a  href="javascript:history.back(-1);"   title="返回"  class="back"><i  class="b_arr"></i>返回</a>
	<a  href="{php echo $this->createMobileUrl('index')}"  title="首页"  class="home">首页</a>
	<h2  id="oneNavTitle">兑换幸运码</h2>
</section>
<section  class="wrap">
	<form id="form1" action="javascript:;" method="post">
	<section  class="white_box">
		<dl  class="order">
			<dt  class="pri_img1"> 
				<a  id="oneGiftLink"  title="(第{$goods['periods']}期){$goods['title']}"><img  id="oneGiftImg"  src="{$_W['attachurl']}{$goods['picarr']}"  alt="(第{$goods['periods']}期){$goods['title']}"></a>
			</dt>
			<dd  class="pri_info1">
				<h3  class="pri_tit"> 
					<a  id="oneGiftName"  title="(第{$goods['periods']}期){$goods['title']}">(第{$goods['periods']}期){$goods['title']}</a>
				</h3>
				<p>总需：<span  id="oneGiftNeed">{$goods['zongrenshu']}</span>份，剩余：<span  id="oneGiftLeft"  class="fc" value="{$goods['shengyurenshu']}">{$goods['shengyurenshu']}</span>份</p>
				<div  id="oneChangeOpt"  class="rec_box"  style=""> 兑换
					<div  class="item_amount ">
						<input  id="oneChangeNum"  type="text"  class="ip_num"  value="{$goods['shengyurenshu']}">
						<textarea id="experience" name="experience" style="display: none;">{$goods['shengyurenshu']}</textarea>
					</div> 
					<span  class="rec_txt">个幸运码</span>
				</div>
			</dd>
		</dl>
	</section>
	</form>
	<section  id="oneDoWrap"  class="abs_bottom"  style="">
		<div  class="submit">
			<p>每个幸运码需<span  id="oneDoChangeNum"  class="fc">1</span>元</p>
			<a  id="oneDoChange"  href="javascript:submit();"  title="提交"  class="smt_btn">提交订单</a>
		</div>
	</section>
	 <a  href="{php echo $this->createMobileUrl('exchange', array('id' => $goods['id']))}"  title="兑换幸运码"  class="chk_btn1"  style="display:">剩余的{$goods['shengyurenshu']}次全包了</a> 
	  <section  class="nav_bar">
   <a  id="oneChangeList"  href="{php echo $this->createMobileUrl('prodata')}"  class="item"> <strong  class="item_txt">个人资料</strong><span  class="rec_num">收货地址设置</span></a>
  </section>
</section>
<div class="g-footer">
    <div class="g-wrap">
        <p>特别说明：为了更好的为您服务，请先设置好您的收货地址<br />如您从未设置过收货地址，从前往个人资料进行设置</p>
		</div>
<script type="text/javascript">
	function submit(){	    
    	var form_input = document.getElementById("form1");
    	var shengyurenshu=form_input['experience'].value;
    	var ip_num=form_input['oneChangeNum'].value;

		if (ip_num>Number(shengyurenshu)) {
			alert('兑换数量超过剩余数量！');
			return false;
		}

		if (ip_num<1) {
			alert('请输入不小于1的整数！');
			return false;
		}
		var url="./index.php?i="+{php echo $uniacid}+"&c=entry&id="+{php echo $goods['id']}+"&count="+ip_num+"&do=postorder&m=feng_duobao&wxref=mp.weixin.qq.com#wechat_redirect";
		
		
		window.location.href=url;
	}
</script>

</body>
<style>
.chk_btn1 {
display: block;
background: #DF144D;
border-radius: 0.6rem;
height: 3rem;
line-height: 3rem;
font-size: 1.2rem;
text-align: center;
color: #fff;
margin: 1rem;
}
.pri_info2 .chk_btn1 {
margin: 1rem 0;
}
.rec_num1 {
font-size: 0.8rem;
color: #ea2127;
position: absolute;
/*top: 1rem;*/
right: 2rem;
}

</style>
<script type="text/javascript">
wx.ready(function () {
	var shareData = {
		title: "{$share_data['share_title']}",
		desc: "{$share_data['share_desc']}",
		link: "{$to_url}",
		imgUrl: "{$_W['attachurl']}{$share_data['share_image']}",
	};
//分享朋友
	wx.onMenuShareAppMessage({
	    title: shareData.title,
	  	desc: shareData.desc,
	  	link: shareData.link,
	  	imgUrl:shareData.imgUrl,
	  	trigger: function (res) {
	  	},
	  	success: function (res) {
	    	window.location.href =adurl;
	  	},
	  	cancel: function (res) {
	  	},
	  	fail: function (res) {
	    	alert(JSON.stringify(res));
	  	}
	});
	//朋友圈
	wx.onMenuShareTimeline({
	  	title: shareData.title+"---"+shareData.desc,
	  	link: shareData.link,
	  	imgUrl:shareData.imgUrl,
	  	trigger: function (res) {
	  	},
	  	success: function (res) {
	    	window.location.href =adurl;
	  	},
	  	cancel: function (res) {
	  	},
	  	fail: function (res) {
	    	alert(JSON.stringify(res));
	  	}
	});   

});
</script>
</html>